package org.theonept.travian.model;

import java.io.Serializable;
import java.util.Arrays;

import org.theonept.travian.t4a.R;

public enum TypeRapport implements Serializable {
	ADVENTURE(R.drawable.report_adventure, "iReport21", R.layout.activity_rapport_bataille), //
	CAPTURE(R.drawable.report_capture_pet, "iReport20", R.layout.activity_rapport_bataille), //
	SPY_DEF_UNSUCCESS(R.drawable.report_espionnagedef_unsucess, "iReport19", R.layout.activity_rapport_bataille), //
	SPY_DEF_SUCCESS(R.drawable.report_espionnagedef_success, "iReport18", R.layout.activity_rapport_bataille), //
	SPY_UNSUCCESS(R.drawable.report_espionnage_lost, "iReport17", R.layout.activity_rapport_bataille), //
	SPY_SUCCESS_LOST(R.drawable.report_espionnage_success_with_lost, "iReport16", R.layout.activity_rapport_bataille), //
	SPY_SUCCESS(R.drawable.report_espionnage_success, "iReport15", R.layout.activity_rapport_bataille), //
	LIV_CEREAL(R.drawable.report_liv_cereale, "iReport14", R.layout.activity_rapport_bataille), //
	LIV_FER(R.drawable.report_liv_fer, "iReport13", R.layout.activity_rapport_bataille), //
	LIV_ARGILE(R.drawable.report_liv_argile, "iReport12", R.layout.activity_rapport_bataille), //
	LIV_BOIS(R.drawable.report_liv_bois, "iReport11", R.layout.activity_rapport_bataille), //
	SOUTIENT(R.drawable.report_soutient, "iReport8", R.layout.activity_rapport_bataille), //
	DEF_NO(R.drawable.report_def_no, "iReport7", R.layout.activity_rapport_bataille), //
	DEF_LOST(R.drawable.report_def_lost, "iReport6", R.layout.activity_rapport_bataille), //
	DEF_SUCCESS_LOST(R.drawable.report_def_success_with_lost, "iReport5", R.layout.activity_rapport_bataille), //
	DEF_SUCESS(R.drawable.report_def_success, "iReport4", R.layout.activity_rapport_bataille), //
	ATT_LOST(R.drawable.report_attack_lost, "iReport3", R.layout.activity_rapport_bataille), //
	ATT_SUCCESS_LOST(R.drawable.report_attack_success_with_lost, "iRepport2", R.layout.activity_rapport_bataille), //
	ATT_SUCESS(R.drawable.report_attack_success, "iReport1", R.layout.activity_rapport_bataille), //
	ESPIONNAGE(R.drawable.report_espionnage, "iReport0", R.layout.activity_rapport_bataille);
	private Integer image;
	private String code;
	private Integer layout;

	/**
	 * @return the image
	 */
	public Integer getImage() {
		return image;
	}

	/**
	 * @param image
	 *            the image to set
	 */
	public void setImage(Integer image) {
		this.image = image;
	}

	/**
	 * @return the code
	 */
	public String getCode() {
		return code;
	}

	/**
	 * @param code
	 *            the code to set
	 */
	public void setCode(String code) {
		this.code = code;
	}

	private TypeRapport(Integer image, String code, Integer layout) {
		this.image = image;
		this.code = code;
		this.setLayout(layout);
	}

	public static TypeRapport getTypeFromCode(String code) {
		TypeRapport typeRapport = null;
		for (TypeRapport type : Arrays.asList(TypeRapport.values())) {
			if (type.code.equals(code)) {
				typeRapport = type;
				break;
			}
		}
		return typeRapport;
	}

	/**
	 * @return the layout
	 */
	public Integer getLayout() {
		return layout;
	}

	/**
	 * @param layout the layout to set
	 */
	public void setLayout(Integer layout) {
		this.layout = layout;
	}
}
